FROM centos:7

MAINTAINER anis

ADD nginx-1.20.1.tar.gz /tmp

RUN yum install -y gcc openssl-devel pcre-devel zlib-devel make

RUN cd /tmp/nginx-1.20.1 \
 && ./configure --prefix=/usr/local/nginx \
 && make && make install \
 && mkdir /usr/local/nginx/conf.d \
 && sed -i '/^http {/a \    include /usr/local/nginx/conf.d/*.conf;' /usr/local/nginx/conf/nginx.conf 
EXPOSE 80

RUN rm -rf /tmp/nginx*

CMD /usr/local/nginx/sbin/nginx -g "daemon off;"
